<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.List" %>
<%@page import="java.util.Iterator" %>
<%@page import="training.entity.User" %>
<%
	List<User> users = (List<User>)request.getAttribute("users");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>User Profiles</title>
<style type="text/css">
	#title {
		text-align: center;
		color: red;
	}
	table {
		margin: auto;
	}
</style>
</head>
<body>
	<h1 id="title">Users List</h1>
	<table border="1">
		<tr>
			<th>Account</th>
			<th>FirstName</th>
			<th>LastName</th>
			<th>Email</th>
			<th>Delete</th>
		</tr>
		<%
		Iterator<User> it = users.iterator();
		User user = null;
		while(it.hasNext()) {
			user = it.next();
			out.print("<tr>");
			out.print("<td>" + user.getAccount() + "</td>");
			out.print("<td>" + user.getFirstName() + "</td>");
			out.print("<td>" + user.getLastName() + "</td>");
			out.print("<td>" + user.getEmail() + "</td>");
			out.print("<td><a href=delete.html?account=" + user.getAccount() + ">Delete</a></td>");
			out.print("</tr>");
		}
		%>
	</table>
	<div>
		<a href="adduser.jsp">Add New User</a>
	</div>
</body>
</html>